<!DOCTYPE html>
<html ng-app="myApp">
<head>
    <meta charset="utf-8">
</head>
<body ng-controller="myCtrl">

执行JavaScript表达式：<br/>
<input type="text" ng-model="expr1"/>
<button ng-click="testExprl(expr1)">计算</button>
<br/><br/><br/>

执行Angular表达式：<br/>
<input type="text" ng-model="expr2"/>
<span ng-bind="$eval(expr2)">计算</span>

</body>
<script src="https://cdn.bootcss.com/angular.js/1.4.6/angular.min.js" type="text/javascript"></script>
<script type="text/javascript">
    angular.module("myApp",[]).controller("myCtrl",['$scope',function($scope){

        $scope.expr1 = 20;
        $scope.expr2 = '20 + 1 | number:0';

        $scope.testExprl = function(expr){
            var newV = parseInt(expr) + 1;
            console.log('old:' + expr + ', new:' + newV);
            $scope.expr1 = newV;
        }

    }]);
</script>
</html>